package com.risetechnology.master;

import android.app.Activity;
import android.content.Intent;
import android.view.View;

public class NavigationActivity extends Activity {
	int nIndex = 0;
	
	@SuppressWarnings("deprecation")
	public void goNextHistory(String id, Intent intent) { 
		NavigationGroup parent = ((NavigationGroup) getParent());

		nIndex++;
		String strInsertID = id;

		strInsertID = strInsertID + nIndex;
		double nRand = Math.random();
		strInsertID = strInsertID + Double.toString(nRand);
		try{
			View view = parent.group.getLocalActivityManager().startActivity(strInsertID,intent).getDecorView();
			parent.group.replaceView(view, strInsertID);
		}catch (Exception e) {
			//goNextHistory(id, intent);
			e.printStackTrace();
		}
	}

	@Override
	public void onBackPressed() {
		NavigationGroup parent = ((NavigationGroup) getParent());
		if (parent != null) {
			parent.back();
		}
	}
	
}
